const rules = { required: true, message: "该选项不能为空", trigger: "blur" };

export const motionControlFormOptions = [
  {
    prop: "Xr",
    label: "前后控制",
    rules,
    customRender() {
      return <el-slider class="mx-2" min={-1} max={1} step={0.1} />;
    },
  },
  {
    prop: "Yr",
    label: "左右控制",
    rules,
    customRender() {
      return <el-slider class="mx-2" min={-1} max={1} step={0.1} />;
    },
  },
  {
    prop: "PITr",
    label: "俯仰姿态控制",
    rules,
    customRender() {
      return <el-slider class="mx-2" min={-1} max={1} step={0.1} />;
    },
  },
  {
    prop: "POLr",
    label: "倾斜姿态控制",
    rules,
    customRender() {
      return <el-slider class="mx-2" min={-1} max={1} step={0.1} />;
    },
  },
  {
    prop: "YAW",
    label: "左右转范围",
    rules,
    customRender() {
      return <el-slider class="mx-2" min={-1} max={1} step={0.1} />;
    },
  },
  {
    prop: "ST",
    label: "ST",
    rules,
    customRender() {
      return <el-switch class="mx-2" active-value={1} inactive-value={0} />;
    },
  },
  {
    prop: "BACK",
    label: "BACK",
    rules,
    customRender() {
      return <el-switch class="mx-2" active-value={1} inactive-value={0} />;
    },
  },
  {
    prop: "lr",
    label: "左右按键",
    rules,
    customRender() {
      return (
        <el-radio-group>
          <el-radio label={1}>左</el-radio>
          <el-radio label={-1}>右</el-radio>
          <el-radio label={0}>无</el-radio>
        </el-radio-group>
      );
    },
  },
  {
    prop: "ud",
    label: "左右按键",
    rules,
    customRender() {
      return (
        <el-radio-group>
          <el-radio label={1}>上</el-radio>
          <el-radio label={-1}>下</el-radio>
          <el-radio label={0}>无</el-radio>
        </el-radio-group>
      );
    },
  },
  {
    prop: "x",
    label: "x",
    rules,
    customRender() {
      return <el-switch class="mx-2" active-value={1} inactive-value={0} />;
    },
  },
  {
    prop: "y",
    label: "y",
    rules,
    customRender() {
      return <el-switch class="mx-2" active-value={1} inactive-value={0} />;
    },
  },
  {
    prop: "b",
    label: "b",
    rules,
    customRender() {
      return <el-switch class="mx-2" active-value={1} inactive-value={0} />;
    },
  },
  {
    prop: "a",
    label: "a",
    rules,
    customRender() {
      return <el-switch class="mx-2" active-value={1} inactive-value={0} />;
    },
  },
  {
    prop: "ll",
    label: "ll",
    rules,
    customRender() {
      return <el-switch class="mx-2" active-value={1} inactive-value={0} />;
    },
  },
  {
    prop: "rr",
    label: "rr",
    rules,
    customRender() {
      return <el-switch class="mx-2" active-value={1} inactive-value={0} />;
    },
  },
  {
    prop: "rr+x",
    label: "rr+x",
    rules,
    customRender() {
      return <el-switch class="mx-2" active-value={1} inactive-value={0} />;
    },
  },
];

export const defaultMotionControlFormData = {
  Xr: 0,
  Yr: 0,
  PITr: 0,
  POLr: 0,
  YAW: 0,
  ST: 0,
  BACK: 0,
  lr: 0,
  ud: 0,
  x: 0,
  y: 0,
  b: 0,
  a: 0,
  ll: 0,
  rr: 0,
  "rr+x": 0,
};

export const robotStatusOptions = [
  { prop: "code", name: "机器人编码" },
  { prop: "robotSta", name: "机器人状态" },
  { prop: "fl0", name: "左前 0 号电机" },
  { prop: "fl1", name: "左前 1 号电机" },
  { prop: "fr0", name: "右前 0 号电机" },
  { prop: "fr1", name: "右前 1 号电机" },
  { prop: "rl0", name: "左后 0 号电机" },
  { prop: "rl1", name: "左后 1 号电机" },
  { prop: "rr0", name: "右后 0 号电机" },
  { prop: "rr1", name: "右后 1 号电机" },
  { prop: "pit", name: "PIT 姿态角度" },
  { prop: "rol", name: "ROL 姿态角度" },
];
